<?
if(!$_SESSION['memberID']){exit("<script>window.location='dlogin.html'</script>");}
include("../../com.inc.php");
$mobile=$_REQUEST["mobile"];
$alipay=$_REQUEST["alipay"];
$act=$_REQUEST["act"];
switch($act){
	case "chM":
		if(!$mobile){exit("请输入手机号");}
		$ps=$_REQUEST["ps"];
		$sel="select id from pft_member where mobile='".$mobile."'";
		$GLOBALS['le']->query($sel);
		$GLOBALS['le']->fetch_assoc();
		if($GLOBALS['le']->f("id")){
			exit("手机号已被使用!");
		}
		$sel="select password from pft_member where id=".$_SESSION['memberID']." limit 1";
		$GLOBALS['le']->query($sel);
		$GLOBALS['le']->fetch_assoc();
		if($GLOBALS['le']->f("password")==md5($ps)){
			$upd="update pft_member set mobile='".$mobile."' where id=".$_SESSION['memberID']." limit 1";
			$GLOBALS['le']->query($upd);
			echo "ok";
		}
		else{
			echo "密码错误!";
		}
		break;
	case "chA":
		if(!$alipay){exit("请输入支付宝帐号");}
		$upd="update pft_member set alipay='".$alipay."' where id=".$_SESSION['memberID']." limit 1";
		$GLOBALS['le']->query($upd);
		echo "ok";
		break;
	case "chH":
		if(!$mobile){exit("请先绑定手机号");}
		$sel="select id from pft_member where mobile='".$mobile."' and id<>".$_SESSION['memberID']." limit 1";
		$GLOBALS['le']->query($sel);
		$GLOBALS['le']->fetch_assoc();
		if($GLOBALS['le']->f("id")){echo "手机号已被使用";}
		break;
}
?>